home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / soft / development / Macromedia RoboHelp X5 / RoboHelpOffice.exe / Data1.cab / _293FBD41C0A142288C82FA5373C61BBE < prev    next >
Encoding:
Text File  |  2002-08-08  |  2.2 KB  |  101 lines

  1. //    WebHelp 5.10.001
  2. var garrSortChar=new Array();
  3. var gaFtsStop=new Array();
  4. var gaFtsStem=new Array();
  5. var gbWhLang=false;
  6.  
  7. /*% OutputSortOrder.js("garrSortChar[%d] = %d;\r\n"); %*/
  8. /*% OutputFtsStopWords.js("gaFtsStop[%d] = \"%s\";\r\n"); %*/
  9. /*% OutputFtsStems.js("gaFtsStem[%d] = \"%s\";\r\n"); %*/
  10.  
  11. // as javascript 1.3 support unicode instead of ISO-Latin-1
  12. // need to transfer come code back to ISO-Latin-1 for compare purpose
  13. // Note: Different Language(Code page) maybe need different array:
  14. var gaUToC=new Array();
  15. gaUToC[8364]=128;
  16. gaUToC[8218]=130;
  17. gaUToC[402]=131;
  18. gaUToC[8222]=132;
  19. gaUToC[8230]=133;
  20. gaUToC[8224]=134;
  21. gaUToC[8225]=135;
  22. gaUToC[710]=136;
  23. gaUToC[8240]=137;
  24. gaUToC[352]=138;
  25. gaUToC[8249]=139;
  26. gaUToC[338]=140;
  27. gaUToC[381]=142;
  28. gaUToC[8216]=145;
  29. gaUToC[8217]=146;
  30. gaUToC[8220]=147;
  31. gaUToC[8221]=148;
  32. gaUToC[8226]=149;
  33. gaUToC[8211]=150;
  34. gaUToC[8212]=151;
  35. gaUToC[732]=152;
  36. gaUToC[8482]=153;
  37. gaUToC[353]=154;
  38. gaUToC[8250]=155;
  39. gaUToC[339]=156;
  40. gaUToC[382]=158;
  41. gaUToC[376]=159;
  42.  
  43. var gsBiggestChar="";
  44. function getBiggestChar()
  45. {
  46.     if(gsBiggestChar.length==0)
  47.     {
  48.         if(garrSortChar.length<256)
  49.             gsBiggestChar=String.fromCharCode(255);
  50.         else
  51.         {
  52.             var nBiggest=0;
  53.             var nBigChar=0;
  54.             for(var i=0;i<=255;i++)
  55.             {
  56.                 if(garrSortChar[i]>nBiggest)
  57.                 {
  58.                     nBiggest=garrSortChar[i];
  59.                     nBigChar=i;
  60.                 }
  61.             }
  62.             gsBiggestChar=String.fromCharCode(nBigChar);
  63.         }
  64.  
  65.     }    
  66.     return gsBiggestChar;
  67. }
  68.  
  69. function getCharCode(str,i)
  70. {
  71.     var code=str.charCodeAt(i)
  72.     if(code>256)
  73.     {
  74.         code=gaUToC[code];
  75.     }
  76.     return code;
  77. }
  78.  
  79. function compare(strText1,strText2)
  80. {
  81.     if(garrSortChar.length<256)
  82.     {
  83.         var strt1=strText1.toLowerCase();
  84.         var strt2=strText2.toLowerCase();
  85.         if(strt1<strt2) return -1;
  86.         if(strt1>strt2) return 1;
  87.         return 0;
  88.     }
  89.     else
  90.     {
  91.         for(var i=0;i<strText1.length&&i<strText2.length;i++)
  92.         {
  93.             if(garrSortChar[getCharCode(strText1,i)]<garrSortChar[getCharCode(strText2,i)]) return -1;
  94.             if(garrSortChar[getCharCode(strText1,i)]>garrSortChar[getCharCode(strText2,i)]) return 1;
  95.         }
  96.         if(strText1.length<strText2.length) return -1;
  97.         if(strText1.length>strText2.length) return 1;
  98.         return 0;
  99.     }
  100. }
  101. gbWhLang=true;